package com.linlz.getGPS;

import java.awt.*;
import java.awt.geom.Point2D;

public class GPSLocation {
    public static void main(String[] args) {
        // 获取屏幕分辨率
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        int screenWidth = (int) screenSize.getWidth();
        int screenHeight = (int) screenSize.getHeight();

        // 计算GPS坐标
        double latitude = (screenHeight / 2.0) / 111.0;
        double longitude = (screenWidth / 2.0) / (111.0 * Math.cos(latitude));
        System.out.println(latitude);

        // 创建Point2D对象
        Point2D.Double gpsLocation = new Point2D.Double(latitude, longitude);

        System.out.println("Latitude: " + gpsLocation.getX());
        System.out.println("Longitude: " + gpsLocation.getY());
    }
}
